Numeric representations in digital signal processing include fixed-point representation and floating-point representation.
In the floating-point representation, each data item has an exponent part and mantissa. This has the advantage of ensuring high accuracy and wide dynamic range, but has the problem of requiring complex, large-scale hardware. On the other hand, the fixed-point representation requires only simple hardware and small-scale circuits, but has the problem of low computational accuracy.
As a solution to the problem with the floating-point representation, a format called block floating-point has been proposed. This format treats a predetermined number (e.g., m) of data items as one data block, gives one block scale factor to each data block, and scales the m data items in the data block equally, thereby making effective use of a limited dynamic range and preventing deterioration in accuracy.
To implement block floating-point operations in software, a source program is written in a predetermined programming language (e.g., in the C language), the source program is translated into an object program using an appropriate compiler, and the object program is executed on a computer.
However, to implement block floating-point operations in software, it is necessary to organize one or more data items into a data group and organize two or more data groups into a data block, which handles a data structure that contains the group scale factors of individual data groups and the block scale factor of the data block. Thus, when writing a source program, the data structure must be defined as a structure. This means that a lot of preparation is required before describing block floating-point operations.
Also, defining a structure makes it possible to use structured data as a cohesive variable for arithmetic operations, but there are certain limits, and the structured data is useful only for simple substitutions or arithmetic operations among structure variables. The simple arithmetic operations here mean arithmetic operations among the same type of structure variables, i.e., among data in the same data group or among scale factors. To implement block floating-point operations, it is necessary to perform arithmetic operations by scaling data according to scale factors. Thus, simple arithmetic operations among structure variables are not enough and a unique function must be created for each type of arithmetic operation. Suppose, for example, functions bfp_add (x.sub.1, x.sub.2) are created to add data in two data blocks. To perform the arithmetic operation of Equation (1), structure variables must be nested as shown in Equation (2). A, B, and C in Equations (1) and (2) below are structure variables (objects) created in a source program according to a block floating-point data structure defined as a structure.Y=A+B+C  (1)Y=bfp.sub.--add(bfp.sub.--add(A,B),C)  (2)
This makes it cumbersome to write a source program and difficult to create a program which contain a small number of bugs.
Furthermore, to perform addition across two or more data blocks at the execution level of an object program, it is necessary to align digit places among the data blocks during the addition because the data in the data blocks have been scaled. For example, when adding data from two different data blocks, data A “0.1” with a group scale factor of “2” and data B “0.11” with a group scale factor of “3,” data A is changed to “0.001” by a two-bits right shift and data B is changed to “0.00011” by a three-bits right shift before the addition. Then, the computational result is normalized again to finally obtain data “0.111” with a group scale factor of “2”.
Thus, to perform addition across data blocks, the data items in each data block must be normalized, and then the data items must be normalized across the data blocks, complicating arithmetic processing. This causes such problems as increased computational load, decreased computing speed, and increase in the number of circuit element. The same is true for subtraction across two or more data blocks.
Furthermore, when performing multiplication-accumulation (arithmetic operations which involve adding multiplication results to obtain their total sum; the same applies hereinafter) across two or more data blocks at the execution level of an object program, specifically, for example, when multiplying data in data blocks A and B and adding data in data block C to the multiplication results, it is necessary to go through three processes: (1) multiplication of data in data blocks A and B, (2) digit place alignment (scaling) between the multiplication results and the data in data block C, and (3) addition of data in data block C to the multiplication results. However, for scaling after the multiplication, a longer bit length must be assigned to structured variables than during the multiplication to avoid cancellation of significant digits by scaling. This not only increases data capacity required for arithmetic operations, but also involves bit length conversion, which may lower computational efficiency.
The present invention has been made in view of unsolved problems with conventional techniques such as those described above. Its first object is to provide a compiler apparatus, compiler program, and object program generating method which make it easy to describe arithmetic operations in source programs, make it simple to write source programs, and reduce bugs, when performing block floating-point operations in software. Its second object is to provide a compiler apparatus, compiler program, and object program generating method which simplify arithmetic processing when performing addition or subtraction in block floating-point format using software. Its third object is to provide a compiler apparatus, compiler program, and object program generating method which decrease data capacity required for arithmetic operations and improve computational efficiency when performing multiplication-accumulation in block floating-point format using software.